<?php
//require_once '../config/db_login_constants.php';
//require_once "../miub/login/session.php";
//include_once 'login/login_db.php';
include_once 'admin_login.php';

session_start();
  if(isset($_POST['submit']) AND $_POST['submit']=='Anmelden' and $_POST['email']!="" and $_POST['userpass']!=""){
  	print_r($_POST);
	
	//echo $err;
	$mylogin = new Admin_login(session_id());
	
	$_SESSION['name']=$mylogin->getName();
	$_SESSION['vorname']=$mylogin->getVorname()	;
	$_SESSION['rechte']=$mylogin->getRechte();
	$_SESSION['session']=$mylogin->getSession();
	if(!isset($_SESSION['name']) and !isset($_SESSION['vorname'] )){
		
		$err="falsche Login-Daten";
		header('Location:http://localhost/miub/admin/login.php?err='.$err);
		
	}else{
		$_SESSION['benutzer']="admin";
		header('Location:http://localhost/miub/admin/index.php');
	}
	
	
}else{
	$err="Invalide Login Daten";
	header('Location:http://localhost/miub/admin/login.php?err='.$err);
	
}
